<?php if (!defined('__COLA_DIR__')) exit;

function themeConfig($form) {
    $logoUrl = new Form_Text('logoUrl', NULL, NULL, _t('站点 LOGO 地址'), _t('在这里填入一个图片 URL 地址, 以在网站标题前加上一个 LOGO'));
    $form->addInput($logoUrl);


    $description = _t('分类mid, 逗号分隔');
    $categoryIgnore = new Form_Text('categoryIgnore', null, null, _t('忽略某个分类(注意：包括子分类)'), $description);
    $form->addInput($categoryIgnore);

    $sidebarBlock = new Form_Checkbox('sidebarBlock', 
    array('ShowRecentPosts' => _t('显示最新文章'),
    'ShowRecentComments' => _t('显示最近回复'),
    'ShowCategory' => _t('显示分类'),
    'ShowArchive' => _t('显示归档'),
    'ShowOther' => _t('显示其它杂项')),
    array('ShowRecentPosts', 'ShowRecentComments', 'ShowCategory', 'ShowArchive', 'ShowOther'), _t('侧边栏显示'));
    
    $form->addInput($sidebarBlock->multiMode());
	
	
    $copyright = new Form_Textarea('copyright', null, null, _t('版权声明'), _t('页脚的版权声明, 允许使用html标签'));
    $form->addInput($copyright);

    $beiAnCode = new Form_Text('beiAnCode', null, null, _t('备案号'), _t('页脚备案号'));
    $form->addInput($beiAnCode);

    $tongJiJs = new Form_Textarea('tongJiJs', null, null, _t('网站统计Js代码'), _t('直接填入统计代码即可'));
    $form->addInput($tongJiJs);

    $advertisingJs = new Form_Textarea('advertisingJs', null, null, _t('广告JS代码'), _t('请填入包括script标签的代码'));
    $form->addInput($advertisingJs);
}

class Theme_Breadcrumbs extends Widget
{
    /**
     * 执行函数,初始化数据
     *
     * @access public
     * @return void
     */
    public function execute()
    {
        $archive = $this->parameter->archive;		

        if ($archive->is('category')) {

			$list = $this->widget('Widget_Metas_Category_List')->getParents($archive->request->mid);
            foreach ($list as $category) {
                $this->push($category);
            }

        } else if ($archive->is('single')) {

			$list = $this->widget('Widget_Metas_Category_List')->getParents($archive->mid);
            foreach ($list as $category) {
                $this->push($category);
            }

        } else if ($archive->is('tag')) {

            $this->db->select()
                ->from('table.metas')
			    ->where('mid = ?', $archive->request->mid)
			    ->fetchRow(array($this, 'push'));
        } else if ($archive->is('author')) {

            $this->db->select()
			    ->from('table.users')
                ->where('uid = ?', $archive->request->uid)
			    ->fetchRow(array($this, 'push'));
        }
    }
}

















function threadedComments($comments) {
        $commentClass = '';
        if ($comments->uid) {
            if ($comments->uid == $comments->ownerId) {
                $commentClass .= ' comment-by-author';
            } else {
                $commentClass .= ' comment-by-user';
            }
        }

?><li id="<?php $comments->theId(); ?>" class="comment-body<?php
    if ($comments->levels > 0) {
        echo ' comment-child';
        $comments->levelsAlt(' comment-level-odd', ' comment-level-even');
    } else {
        echo ' comment-parent';
    }
    $comments->alt(' comment-odd', ' comment-even');
    echo $commentClass;
?>">

<div class="author"><div class="v-tooltip-content"><a href="<?php $comments->permalink(); ?>" class="comment-avatar"><img src="<?php $comments->author->avatar(); ?>"></a></div><div class="info"><a href="<?php $comments->permalink(); ?>" class="name"><?php $comments->author->name(); ?></a><div class="meta"><span><?php $comments->order(); ?>楼 · <?php $comments->date($comments->parameter->dateFormat); ?></span></div></div></div>

    <div class="comment-content" >
    <?php $comments->content(); ?>
    </div>
    <div class="comment-reply">
        <?php $comments->reply(); ?>
    </div>
    <?php if ($comments->children) { ?>
    <div class="comment-children">
        <?php $comments->threadedComments(); ?>
    </div>
    <?php } ?>
</li>
<?php } ?>



<?php

function themeInit($archive)
{
	if($archive->is('login')){
	    //$archive->setThemeDir(Helper::options()->themeDir);
	}
}









